<html>

<head>
  <meta charset="utf-8">
  <meta name="author" content="http://www.softwhy.com/" />
  <title>蚂蚁部落</title>
  <script type="text/javascript">
    window.onload = function () {
      var otxt = document.getElementById("txt");
      var oshow = document.getElementById("show");
      var count = 0;
      if (document.all) {
        document.querySelector("#txt").onpropertychange = () => {
          count = count + 1;
          console.log('xixi')
          alert('gaga')
          document.querySelector('#show').innerHTML = 'xixi';
        }

      } else {
        otxt.oninput = function () {
          count = count + 1;
          oshow.innerHTML = 'xixi';
        }
      }
    }
  </script>
</head>

<body>
  <div id="show"></div>
  <input type="text" id="txt" value="蚂蚁部落" />
</body>

</html>
---------------------
作者：xiao_shutong
来源：CSDN
原文：https://blog.csdn.net/xiao_shutong/article/details/77145912
版权声明：本文为博主原创文章，转载请附上博文链接！